//
//  BaseTableViewController.swift
//  我的微博
//
//  Created by WUSANZHONG on 15/9/6.
//  Copyright © 2015年 WUSANZHONG. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    //通过 userLogin 的值来显示登录界面或主界面
    var userLogin = false
    
    override func loadView() {
        
        userLogin ? super.loadView() : userLoginView()
    }
    
    func userLoginView(){
        
        //访客视图
        view = VisitorLoginView()
        
        //添加导航栏的左右按钮
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle(rawValue: 0)!, target: self, action: "clickLoginButton")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle(rawValue: 0)!, target: self, action: "clickRegisterButton")
    }
    
    func clickLoginButton() {
        
        print("登录")
    }
    
    func clickRegisterButton() {
        
        print("注册")
    }

}
